﻿from enum import IntEnum

from Devices.Chiot.ChiotDevice import ChiotDevice

class DeviceBulb(ChiotDevice):
    class LedDriver(IntEnum):
        LED_DRIVER_BP5758D = 0
        LED_DRIVER_BP1658CJ = 1
        LED_DRIVER_INVALID = 2

    class PowerType(IntEnum):
        BULB_TYPE_9W = 0
        BULB_TYPE_12W = 1
        BULB_TYPE_INVALID = 2

    class CloudType(IntEnum):
        CHCLOUD_HTTPS_SERVER = 1
        CHCLOUD_HTTPS_SERVER_AWS = 2
        CHCLOUD_HTTPS_SERVER_AWS_DEV = 3
        CHCLOUD_HTTPS_SERVER_BUSINESS = 4
        CHCLOUD_HTTPS_SERVER_BUSINESS_DEV = 5
        CHCLOUD_HTTPS_SERVER_LOCAL_TEST = 6
        CHCLOUD_HTTPS_SERVER_INVALID = 255

    class InterfaceType(IntEnum):
        INTERFACE_TYPE_E27 = 0
        INTERFACE_TYPE_B22 = 1
        INTERFACE_TYPE_INVALID = 2

    class MemoryLightMode(IntEnum):
        MEMORY_LIGHT_SAVE = 0
        MEMORY_LIGHT_DEFAULT = 1
        MEMORY_LIGHT_CUSTOM = 2

    class LightMode(IntEnum):
        LIGHT_RGB = 0
        LIGHT_WHITE = 1
        LIGHT_ATMOSPHERE = 2

    class RGB:
        def __init__(self, rgbBrightness=0, saturation=0, red=0, green=0, blue=0):
            self.rgbBrightness = rgbBrightness
            self.saturation = saturation
            self.red = red
            self.green = green
            self.blue = blue

    class White:
        def __init__(self, whiteBrightness = 0, temprature = 0):
            self.whiteBrightness = whiteBrightness
            self.temprature = temprature

    class LightAttr:
        def __init__(self):
            self.lightMode = DeviceBulb.LightMode.LIGHT_RGB
            self.rgb = DeviceBulb.RGB()
            self.white = DeviceBulb.White()

    class AtmosphereAttr:
        def __init__(self):
            self.id = 0
            self.script = ""

    class Currents:
        def __init__(self):
            self.red = 0
            self.green = 0
            self.blue = 0
            self.warm = 0
            self.cold = 0

    class DeviceFullStatus:
        def __init__(self):
            self.mac = ""
            self.heartbeatFreq = 0
            self.firmwareVersion = ""
            self.hardwareVersion = ""
            self.modelId = ""
            self.protocol = ""
            self.timezone = ""
            self.buildTime = ""
            self.powerType = DeviceBulb.PowerType.BULB_TYPE_INVALID
            self.ledDriver = DeviceBulb.LedDriver.LED_DRIVER_INVALID
            self.cloudType = DeviceBulb.CloudType.CHCLOUD_HTTPS_SERVER_INVALID
            self.interfaceType = DeviceBulb.InterfaceType.INTERFACE_TYPE_INVALID
            self.gradientTime = 0
            self.scheduleOpenLog = False
            self.currents = DeviceBulb.Currents()
            self.switch_state = False
            self.noDisturb = False
            self.lightAttr = DeviceBulb.LightAttr()
            self.memoryLightMode = DeviceBulb.MemoryLightMode.MEMORY_LIGHT_SAVE
            self.memoryLightAttr = DeviceBulb.LightAttr()
            self.atmosphereAttr = DeviceBulb.AtmosphereAttr()
            self.timers = []
            self.delay = DeviceBulb.Delay()
